﻿using Sgr.UPMS.Application.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sgr.UPMS.Application.Queries
{
    /// <summary>
    /// 用户权限查询服务接口
    /// </summary>
    public interface IUserPermissionQueries
    {
        /// <summary>
        /// 获取用户的权限信息
        /// </summary>
        /// <param name="userId">用户标识</param>
        /// <param name="orgId">组织标识</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns>用户权限信息视图模型</returns>
        /// <remarks>
        /// 该方法会从缓存中获取数据,如果缓存不存在则从数据库加载并写入缓存
        /// </remarks>
        Task<OutUserPermissionViewModel?> GetUserPermissionAsync(
           long userId,
           long orgId,
           CancellationToken cancellationToken = default);

        /// <summary>
        /// 获取用户可访问的菜单树
        /// </summary>
        /// <param name="userId">用户标识</param>
        /// <param name="orgId">组织标识</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns>用户菜单树视图模型集合</returns>
        /// <remarks>
        /// 该方法会:
        /// 1. 获取用户的权限信息
        /// 2. 根据权限过滤可访问的菜单
        /// 3. 构建菜单树结构
        /// </remarks>
        Task<IEnumerable<OutUserMenuViewModel>> GetUserMenusAsync(
            long userId,
            long orgId,
            CancellationToken cancellationToken = default);
    }
}